package com.woniuxy.shiro.controller;

import com.woniuxy.shiro.utils.ResponseResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@Controller
@RequestMapping("/jump")
public class JumpController {
    //去登录
    @RequestMapping("/toLogin")
    @ResponseBody
    public ResponseResult<String> toLogin(){
        ResponseResult<String> result = new ResponseResult<>();
        result.setCode(500);
        result.setData("TO_LOGIN");
        result.setMessage("请登录");
        return result;
    }
    //没权限
    @RequestMapping("/unauthorized")
    @ResponseBody
    public ResponseResult<String> unauthorized(){
        ResponseResult<String> result = new ResponseResult<>();
        result.setCode(500);
        result.setData("NO_UNAUTHORIZED");
        result.setMessage("你没有权限");
        return result;
    }
    //去主页面
    @RequestMapping("/main")
    public String toMain(){
        System.out.println("通过后台跳转到首页");
        return "/main.html";
    }
}
